<form id="pagerForm" method="post" action="<?php echo site_url('index.php?m=baobeiinfo');?>">
	<input type="hidden" name="pageNum" value="1" />
	<input type="hidden" name="numPerPage" value="<?php echo $list['pager']->per_page;?>" />
    <input type="hidden" name="baobei_name" value="<?php echo $_input->post('baobei_name');?>" />
    <input type="hidden" name="source" value="<?php echo $_input->post('source');?>" />
    <input type="hidden" name="type" value="<?php echo $_input->post('type');?>" />
</form>

<div class="pageHeader">
	<div class="searchBar">
		<table class="searchContent">
			<tr>
				<td><!--http://item.taobao.com/item.htm?spm=a2106.m885.1000384.d11&id=15625664700&scm=1029.0.1.0-->
					宝贝地址：<input type="text" name="baobei_url" id="_baobei_url" style="width: 620px" value=""/>
				</td>
                <td><div class="button"><div class="buttonContent"><button type="button" id="_get_baobei_url"  href="<?php echo site_url('api/search_taobao.php?');?>url={baobei_url}"  rel="search_info">抓取信息</button></div></div></td>
                <td><font style="color: red;">*注：</font>目前只支持（<font style="color: red;">淘宝,天猫,拍拍,凡客</font>）</td>
			</tr>
		</table>
	</div>
</div>
<div class="pageHeader">
    <form onsubmit="return navTabSearch(this);" action="<?php echo site_url('index.php?m=baobeiinfo');?>" method="post">
        <div class="searchBar">
            <table class="searchContent">
                <tr>
                    <td>
                        宝贝名称：<input type="text" name="baobei_name" value="<?php echo $_input->post('baobei_name');?>"/>
                    </td>
                    <td>
                        <select class="combox" name="source">
                            <option value="">所有来源</option>
                            <?php foreach($source_list as $k=>$v){ ?>
                            <option value="<?php echo $k; ?>" <?php echo $_input->post('source') == $k ? 'selected="selected"' : ''; ?>><?php echo $v; ?></option>
                            <?php } ?>
                        </select>
                    </td>
                    <td>
                        <select class="combox" name="type">
                            <option value="">发现宝贝</option>
                            <?php foreach($type_list as $k=>$v){ ?>
                            <option value="<?php echo $k; ?>" <?php echo $_input->post('type') == $k ? 'selected="selected"' : ''; ?>><?php echo $v; ?></option>
                            <?php } ?>
                        </select>
                    </td>
                </tr>
            </table>
            <div class="subBar">
                <ul>
                    <li><div class="buttonActive"><div class="buttonContent"><button type="submit">搜索</button></div></div></li>
                </ul>
            </div>
        </div>
    </form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
            <li><a class="add" href="<?php echo site_url('index.php?m=baobeitype&a=add');?>" target="dialog" height="230" rel="add_baobeitype"><span>添加</span></a></li>
            <li class="line">line</li>
			<li><a class="delete" href="<?php echo site_url('baobeiinfo.php?a=del');?>&baobei_id={sid}" target="ajaxTodo" title="确定要删除吗?"><span>删除</span></a></li>
            <li class="line">line</li>
			<li><a class="edit" href="<?php echo site_url('baobeiinfo.php?a=edit');?>&baobei_id={sid}" target="dialog" height="450" rel="edit_user"><span>修改</span></a></li>
		</ul>
	</div>
	<table class="table" width="100%" layoutH="174">
		<thead>
			<tr>
                <th width="100" align="center">名称</th>
                <th width="20" align="center">价格</th>
                <th width="20" align="center">类型</th>
                <th width="20" align="center">图片</th>
                <th width="20" align="center">添加时间</th>
				<th width="30" align="center">操作</th>
			</tr>
		</thead>
		<tbody>
            <?php foreach((array)$list['rs'] as $v){?>
            <tr target="sid" rel="<?php echo $v['baobei_id'];?>">
                <td title="<?php echo $v['baobei_name'];?>"><?php echo $v['baobei_name'];?></td>
                <td><?php echo $v['baobei_price'];?></td>
                <td><?php echo $type_list[$v['baobei_type_id']];?></td>
                <td><?php echo count(explode('|',$v['baobei_image_url'])).'-张';?></td>
                <td><?php echo $v['baobei_add_time'];?></td>
                <td>
                    <a href="<?php echo site_url('baobeiinfo.php?a=edit');?>&baobei_id=<?php echo $v['baobei_id'];?>" target="dialog" height="450">编辑</a> |
                    <a href="<?php echo site_url('baobeiinfo.php?a=del');?>&baobei_id=<?php echo $v['baobei_id'];?>" target="ajaxTodo" title="确定要删除吗?">删除</a>
                </td>
            </tr>
            <?php }?>
		</tbody>
	</table>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
            <?php
                $_pager_num_type = array(30,50,100);
            ?>
			<select class="combox" name="numPerPage" change="navTabPageBreak" param="numPerPage">
                <?php
                    foreach($_pager_num_type as $v){
                        echo '<option value="'.$v.'" '.($list['pager']->per_page == $v ? 'selected':'').'>'.$v.'</option>';
                    }
                ?>
			</select>
			<span>条，共<?php echo $list['pager']->getTotalCount();?>条</span>
		</div>
		
		<div class="pagination"
             targetType="navTab"
             totalCount="<?php echo $list['pager']->getTotalCount();?>"
             numPerPage="<?php echo $list['pager']->per_page;?>"
             pageNumShown="5"
             currentPage="<?php echo $list['pager']->curr_page;?>">
        </div>

	</div>
</div>
<script type="text/javascript">

    (function($){
        $('#_get_baobei_url').click(function(){
            var http_url = $('#_baobei_url');

            $.ajax({
                type: 'POST',
                url: './../api/take_baobei_info/take_baobei_info.php?t=' + new Date().getTime(),
                data:{"url": encodeURI(http_url.val())},
                dataType:'json',
                beforeSend:function() {
                },
                success:function (data) {
                    if(data.retCode == 200){
                        http_url.val('');
                        console.log(data);
                        //$.pdialog.open('view/baobei/add_baobei.php?url='+baobei.message, 'add_baobei', '添加宝贝信息', {width:'750',height:'600',mask:true});
                    }
                }
            });

        });
    })(jQuery);
</script>
